package excel
{
	import com.as3xls.xls.*;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLLoaderDataFormat;

	public class ReadExcelAsXml extends Sprite
	{
		private var path:String = "e:\\general_condition_text.xls";
		
		public function ReadExcelAsXml()
		{
			/*var excelXml;
			var l:URLLoader = new URLLoader();
			l.addEventListener("complete",hLoadComplete);
			l.load(new URLRequest("data.xml"));
			function hLoadComplete(evt) {
				excelXml=new XML(evt.target.data);
				readData(excelXml);
			}
			function readData(xml) {
				var ns=xml.namespace();
				var rows=xml..ns::Row;
				for each (var r in rows) {
					var cellData=r.ns::Cell.ns::Data.text();
					for each (var d in cellData) {
						out_txt.appendText(d+",");
					}
					out_txt.appendText("\n");
				}
			}*/
			readXls();
		}
		
		
		public function readXls():void {
			var urlLoader:URLLoader = new URLLoader();
			urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
			var urlRequest:URLRequest = new URLRequest(path);
			urlLoader.addEventListener(Event.COMPLETE, onLoadXlsComplete);
			urlLoader.load(urlRequest);
		}
		
		public function onLoadXlsComplete(event:Event):void {
			trace("load complete....");
			var xls:ExcelFile = new ExcelFile();
//			xls.loadFromByteArray((event.currentTarget as URLLoader).data);
			
			trace(xls.sheets);
		}
	}
}